package com.atguigu.springcloud.service;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @desc feigin接口
 * @auther zzyy
 * @create 2020-02-19 23:59
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {
    @GetMapping(value = "/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);


    @GetMapping(value = "/payment/get/{id}/{name}")
    public CommonResult<Payment> getPaymentByIdAndName(@PathVariable("id") Long id, @PathVariable("name") String name);


    @GetMapping(value = "/payment/get01")
    public CommonResult<Payment> getPaymentById01(@RequestParam("id") Long id);


    @GetMapping(value = "/payment/get02")
    public CommonResult<Payment> getPaymentById02(@RequestParam("id") Long id,
                                                  @RequestParam("name") String name);

    @GetMapping(value = "/payment/get03/{id}")
    public CommonResult<Payment> getPaymentById03(@PathVariable("id") Long id,
                                                  @RequestParam("name") String name);

    @PostMapping("/payment/create")
    public CommonResult create(@RequestBody Payment payment);


    @PostMapping("/payment/create01/{id}")
    public CommonResult create01(@RequestBody Payment payment, @PathVariable("id") Long id);

    @PostMapping("/payment/create02/{id}")
    public CommonResult create02(@RequestBody Payment payment, @PathVariable("id") Long id, @RequestParam("name") String name);

    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeout();
}
